Description:
IOB detects situtations where a loop iterator variable is compared with
the length of one array but is used to access elements of another array.
This audit can work in several modes which can be selected by the option
Level of checking in the audit properties. Checks performed
at a higher level include all of the checks performed at lower levels.
while i = High(array)+1 do ...
while i <= High(array)+1 do ...
while i > High(array) do ...
while i >= High(array)+1 do ...
for i:= 0 to High(arr1) do
for j:= 0 to High(arr2) do
arr1[i] := arr2[i];
Incorrect:
for i := 0 to nIterations do
begin
sum := 0;
for j := 0 to High(arr) do
sum := sum + arr[i];
end;
Correct:
for i := 0 to nIterations do
begin
sum := 0;
for j := 0 to High(arr) do
sum := sum + arr[j];
end;